﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using DLV.Utilities;

namespace DLV.Data.Entities
{
    public class RoomTypeController
    {
        public int InsertRoomType(RoomTypeInfo info)
        {
            return SQL.InsertRoomType(info.RoomTypeName, info.CreatedBy, info.CreatedDate, info.UpdatedBy, info.UpdatedDate, info.Status);
        }
        public void UpdateRoomType(RoomTypeInfo info)
        {
            SQL.UpdateRoomType(info.RoomTypeId, info.RoomTypeName, info.CreatedBy, info.CreatedDate, info.UpdatedBy, info.UpdatedDate, info.Status);
        }
        public void DeleteRoomType(RoomTypeInfo info)
        {
            DeleteRoomType(info.RoomTypeId);
        }
        public void DeleteRoomType(int roomTypeId)
        {
            SQL.DeleteRoomType(roomTypeId);
        }
        public RoomTypeInfo GetRoomType(int roomTypeId)
        {
            return CBO.FillObject<RoomTypeInfo>(SQL.GetRoomType(roomTypeId));
        }
        public List<RoomTypeInfo> ListRoomType()
        {
            return CBO.FillCollection<RoomTypeInfo>(SQL.ListRoomType());
        }
        public List<RoomTypeInfo> ListRoomTypeByHotel(int hotelId, string season)
        {
            return CBO.FillCollection<RoomTypeInfo>(SQL.ListRoomTypeByHotel(hotelId, season));
        }
        public DataTable SelectRoomType()
        {
            return CBO.ConvertToDataTable(ListRoomType(), typeof(RoomTypeInfo));
        }
        public Dictionary<object, object> ListRoomTypeLookup()
        {
            var users = ListRoomType();
            var dicusers = new Dictionary<object, object>();
            foreach (RoomTypeInfo info in users)
                dicusers.Add(info.RoomTypeId, info.RoomTypeName);

            return dicusers;
        }
    }
}
